package com.laowang.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.laowang.framework.aspectj.lang.annotation.Log;
import com.laowang.framework.aspectj.lang.enums.BusinessType;

import org.springframework.web.bind.annotation.*;
import com.laowang.project.system.domain.MyCyhIntro;
import com.laowang.project.system.service.MyCyhIntroService;
import com.laowang.framework.web.controller.BaseController;
import com.laowang.framework.web.domain.AjaxResult;
import com.laowang.common.utils.poi.ExcelUtil;
import com.laowang.framework.web.page.TableDataInfo;

/**
 * h5车友会介绍Controller
 * 
 * @author laowang
 * @date 2023-10-13
 */
@Api(tags = "h5车友会介绍接口")
@RestController
@RequestMapping("/intro")
public class MyCyhIntroController extends BaseController {
    @Autowired
    private MyCyhIntroService myCyhIntroService;

    @ApiOperation(value = "查询h5车友会介绍列表",notes = "")
    @GetMapping("/h5")
    public AjaxResult h5() {

        MyCyhIntro myCyhIntro = myCyhIntroService.selectMyCyhIntroById(1);
        return AjaxResult.success("成功",myCyhIntro);
    }


    /**
     * 查询h5车友会介绍列表
     */
    @ApiOperation(value = "查询h5车友会介绍列表",notes = "")
    @PreAuthorize("@ss.hasPermi('my:intro:list')")
    @GetMapping("/list")
    public TableDataInfo list(MyCyhIntro myCyhIntro) {
        startPage();
        List<MyCyhIntro> list = myCyhIntroService.selectMyCyhIntroList(myCyhIntro);
        return getDataTable(list);
    }
    
    /**
     * 导出h5车友会介绍列表
     */
    @ApiOperation(value = "导出h5车友会介绍列表",notes = "")
    @PreAuthorize("@ss.hasPermi('my:intro:export')")
    @Log(title = "h5车友会介绍", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MyCyhIntro myCyhIntro) {
        List<MyCyhIntro> list = myCyhIntroService.selectMyCyhIntroList(myCyhIntro);
        ExcelUtil<MyCyhIntro> util = new ExcelUtil<MyCyhIntro>(MyCyhIntro.class);
        return util.exportExcel(list, "intro");
    }

    /**
     * 获取h5车友会介绍详细信息
     */
    @ApiOperation(value = "获取h5车友会介绍详细信息",notes = "")
    @PreAuthorize("@ss.hasPermi('my:intro:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return AjaxResult.success(myCyhIntroService.selectMyCyhIntroById(id));
    }

    /**
     * 新增h5车友会介绍
     */
    @ApiOperation(value = "新增h5车友会介绍",notes = "")
    @PreAuthorize("@ss.hasPermi('my:intro:add')")
    @Log(title = "h5车友会介绍", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MyCyhIntro myCyhIntro) {
        return toAjax(myCyhIntroService.insertMyCyhIntro(myCyhIntro));
    }

    /**
     * 修改h5车友会介绍
     */
    @ApiOperation(value = "修改h5车友会介绍",notes = "")
    @PreAuthorize("@ss.hasPermi('my:intro:edit')")
    @Log(title = "h5车友会介绍", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MyCyhIntro myCyhIntro) {
        return toAjax(myCyhIntroService.updateMyCyhIntro(myCyhIntro));
    }

    /**
     * 删除h5车友会介绍
     */
    @ApiOperation(value = "删除h5车友会介绍",notes = "")
    @PreAuthorize("@ss.hasPermi('my:intro:remove')")
    @Log(title = "h5车友会介绍", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(myCyhIntroService.deleteMyCyhIntroByIds(ids));
    }
}
